<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('免疫记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row" id="printArea">
			<div class="col-sm-12 search-collapse">
		<!--	 <form id="formId">
					<div class="select-list">
						<input hidden="hidden"  name="orderId" th:value="${orderId}"/>
						<ul>
							<li>
								&lt;!&ndash;                            <label class="col-sm-3 control-label">圈舍号： </label>&ndash;&gt;
								<span class="col-sm-8">
                                <span> 圈舍号: </span>
                               <span>
                                   <select name="roomNum"  th:with="type=${@dict.getType('cow_juanshe_num')}">
                                     <option value="" >无</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                               </span>
                            </span>
							</li>

							<li>
								疫苗名称：<input name="ymName" type="text"/>
							</li>

							<li>
								疫苗生产厂家：<input name="ymFactory" type="text"/>
							</li>



							<li>
								免疫方法：<input name="myWays" type="text"/>
							</li>

							<li>
								<label class="col-sm-3 control-label">免疫操作员：</label>
								<div class="col-sm-8">
									<select id="createBy" name="createBy"  >
										<option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}"></option>
									</select>
								</div>
							</li>

							<li>
								免疫时间： <input id="createTime"  data-format="yyyy-MM-dd HH:mm:ss" name="createTime"  class="form-control"  type="text" th:class="time-input">
							<li/>


							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
										class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
										class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>-->
			</div>

	        <div class="btn-group-sm" id="toolbar" role="group">
<!--
				<a class="btn btn-primary " onclick="openOrder()">
					<i class="fa fa-table"></i> 免疫记录单
				</a>


				<a class="btn btn-warning" onclick="confirmTable();">
					<i class="fa fa-send"></i> 单据确认
				</a>
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncMianyiLogs:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:ncMianyiLogs:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger  disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:ncMianyiLogs:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncMianyiLogs:export">
						<i class="fa fa-download"></i> 导出
				 </a>-->

				<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncXunshiLogs:export">
					<i class="fa fa-download"></i> 导出
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncXunshiLogs:export">
					<i class="fa fa-download"></i> 打印
				</a>-->
			</div>
			<h3 align="center"> <span th:text="鸡舍免疫" id="ordercode" hidden="hidden"></span> </h3>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
				<h3> <span class="fl-l" id="autograph" hidden="hidden"></span> </h3>
			</div>


			<div class="btn-group-sm" id="toolbar1" role="group">

				<a class="btn btn-warning" onclick="$.table.exportExcel()">
					<i class="fa fa-download"></i> 导出
				</a>
				<a class="btn btn-warning" id="print-btn" orderType = "18">
					<i class="fa fa-download"></i> 打印
				</a>
				<!--            <div></div>-->
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:ncMianyiLogs:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:ncMianyiLogs:remove')}]];
        var prefix = ctx + "system/ncMianyiLogs/chicken";

        $(function() {
            var options = {
                url: prefix + "/list/2/4?orderId="+[[${orderId}]],
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "免疫记录",
		        showExport: false,
				showSearch: false,
				showRefresh: false,
				showColumns: false,
				showToggle: false,
				toolbar: 'toolbar1',
                columns: [
                		/*{
		            checkbox: true
		        },*/
				{
					field : 'myId',
					title : '诊疗id',
					visible: false
				},
				/* {
					field : 'myType',
					title : '免疫类型 1:牛舍 2：鸡舍',
					sortable: true
				},
				 {
					field : 'myStatus',
					title : '状态:1：待确认 2：已挂起 3：已确认：4：已生成订单',
					sortable: true
				},*/
				{
					field : 'roomNum',
					title : '圈舍号',
					sortable: true
				},
				 {
					field : 'orderId',
					title : '订单id',
					sortable: false
				},
				{
					field : 'stockAmount',
					title : '存栏数量',
					sortable: true
				},
				{
					field : 'myAmount',
					title : '免疫数量',
					sortable: true
				},
				{
					field : 'ymName',
					title : '疫苗名称',
					sortable: true
				},
				{
					field : 'ymFactory',
					title : '疫苗生产厂家',
					sortable: true
				},
				{
					field : 'ymCode',
					title : '批号（有效期）',
					sortable: true
				},
				{
					field : 'myWays',
					title : '免疫方法',
					sortable: true,
					formatter: function (value, row, index) {
						if ("1" === value){
							return "注射";
						}else if ("2" === value){
							return "喂食";
						}
					}
				},
				{
					field : 'myDose',
					title : '免疫剂量',
					sortable: true
				},
				{
					field : 'createBy',
					title : '免疫操作员',
					sortable: true
				},
				{
					field : 'createTime',
					title : '免疫时间',
					sortable: true
				},
				{
					field : 'remark',
					title : '备注',
					sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.myId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.myId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });



		/*打开xsId*/
		function openOrder() {
			var url = ctx + 'system/ncOrder?orderType=18';
			$.modal.openTab("鸡舍免疫记录单", url);
		}

		/*表单确认*/
		function confirmTable() {
			var confirmTable = prefix + "/confirmTable/15";
			var data = $('#bootstrap-table').bootstrapTable('getData');
			if (data && data.length > 0) {
				$.modal.confirm("确认生成鸡舍免疫巡视单吗？", function () {
					var ids = [];
					$(data).each(function (i, e) {
						ids.push(e.myId);
					});
					var ids_str = ids.join(",");
					myPost(confirmTable, {ids: ids_str},
							function (data) {

								if (data.code == 0) {
									layer.msg("提交成功")
								} else {
									layer.msg(data.msg);
								}
								reload()
							}, function (e) {
								layer.msg("确认失败!");
								reload()
							})

				})
			} else {
				layer.msg("未发现数据!")
			}

		}

		//刷新页面
		function reload() {
			window.location.reload()
		}

    </script>
</body>
</html>